package pojo.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import pojo.Do.TelPhone;
import pojo.Do.UserDo;
import pojo.dto.UserDto;

@Mapper
public interface UserConverte {

    UserConverte INSTANCE = Mappers.getMapper(UserConverte.class);

    @Mappings({
            @Mapping(source = "user_name",target = "userName"),
            @Mapping(source = "user_password",target = "password"),
            @Mapping(source = "user_email",target = "userEmail"),
    })
    UserDto userDoToDto(UserDo userDo);

    @Mappings({
            @Mapping(source = "userDo.user_name", target = "userName"),
            @Mapping(source = "userDo.user_password", target = "password"),
            @Mapping(source = "userDo.user_email", target = "userEmail"),
            @Mapping(source = "telPhone.telPhone", target = "tel"),
    })
    UserDto userDoToDto1(UserDo userDo, TelPhone telPhone);
}
